package pro.lingwu.rainbowmall.config

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import springfox.documentation.builders.ApiInfoBuilder
import springfox.documentation.builders.PathSelectors
import springfox.documentation.builders.RequestHandlerSelectors
import springfox.documentation.service.ApiInfo
import springfox.documentation.service.Contact
import springfox.documentation.spi.DocumentationType
import springfox.documentation.spring.web.plugins.Docket
import springfox.documentation.swagger2.annotations.EnableSwagger2

/**
 * <p>Swagger文档的配置</p>
 * @author  lingwu
 *
**/


@Configuration
@EnableSwagger2
class SwaggerConfig {

    @Bean fun apiInfo(): ApiInfo =ApiInfoBuilder()
        .version("0.0.1")
        .title("Rainbow Mall 后端api - kotlin")
        .description("Rainbow Mall 的后端api文档 - kotlin版本")
        .contact(Contact("lingwu", null, "1396119095@qq.com"))
        .build()

    @Bean fun docket(apiInfo: ApiInfo): Docket = Docket(DocumentationType.OAS_30)
        .apiInfo(apiInfo)
        .select()
        .paths(PathSelectors.any())
        .apis(RequestHandlerSelectors.any())
        .build()
}
